package com.wxg.demo;

import com.wxg.utils.My;
import com.wxg.utils.MyFileReader;
import com.wxg.utils.MyFileWriter;

/**
 * 
 * 插入PageHeader,PageFooter
 * 
 * 
 * @author Wxg
 *
 */
public class Emr101 {

	public static void main(String[] args) {
		code102();
	}

	/**
	 * com/wxg/html/a102
	 * no table
	 * 
	 */
	public static void code102(){
		
		// writer
		String dir = My.conf("htmlStoreDir");
		String filepath = dir + My.SP + My.ss("html_") + ".html";
		MyFileWriter writer = new MyFileWriter(filepath);
		
		writer.writeb("<html>");
		
		// head
		MyFileReader mfr = new MyFileReader("com/wxg/html/a102/head.html");
		for(String str : mfr.list()){
			writer.writeb(str);
		}
		// body
		writer.writeb("<body>");
		// page_header
		mfr = new MyFileReader("com/wxg/html/a102/pageHeader.html");
		for(String str : mfr.list()){
			writer.writeb(str);
		}
		
		writer.writeb("<h1>Hello,World!</h1>");
		
		// page_footer
		mfr = new MyFileReader("com/wxg/html/a102/pageFooter.html");
		for(String str : mfr.list()){
			writer.writeb(str);
		}
		
		writer.writeb("</body>");
		
		writer.writeb("</html>");
		
		// writer close
		writer.close();
	}
	
	/**
	 * com/wxg/html/a101
	 * table layout
	 * 
	 * 
	 */
	public static void code101(){
		
		// writer
		String dir = My.conf("htmlStoreDir");
		String filepath = dir + My.SP + My.ss("html_") + ".html";
		MyFileWriter writer = new MyFileWriter(filepath);
		
		writer.writeb("<html>");
		
		// head
		MyFileReader mfr = new MyFileReader("com/wxg/html/a101/head.html");
		for(String str : mfr.list()){
			writer.writeb(str);
		}
		// body
		writer.writeb("<body>");
		// page_start
		mfr = new MyFileReader("com/wxg/html/a101/pageStart.html");
		for(String str : mfr.list()){
			writer.writeb(str);
		}
		// page_header
		mfr = new MyFileReader("com/wxg/html/a101/pageHeader.html");
		for(String str : mfr.list()){
			writer.writeb(str);
		}
		
		writer.writeb("<h1>Hello,World!</h1>");
		
		// page_footer
		mfr = new MyFileReader("com/wxg/html/a101/pageFooter.html");
		for(String str : mfr.list()){
			writer.writeb(str);
		}
		// page_end
		mfr = new MyFileReader("com/wxg/html/a101/pageEnd.html");
		for(String str : mfr.list()){
			writer.writeb(str);
		}
		
		writer.writeb("</body>");
		
		writer.writeb("</html>");
		
		// writer close
		writer.close();
	}

}
